package dp;

public class LongestIncreasingSubsequence300 {
    public int lengthOfLIS(int[] nums) {
        int[] len = new int[nums.length];
        int maxLen = 0;
        for (int i = 0; i < nums.length; i++) {
            len[i] = 1;
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]) {
                    if (len[j] + 1 > len[i]) {
                        len[i] = len[j] + 1;
                    }
                }
            }
            if (len[i] > maxLen) {
                maxLen = len[i];
            }
        }
        return maxLen;
    }
}
